import { request } from '@/utils/request';

export type NewItem = {
  id: string;
  source: string;
  rank_num: number;
  summary_content: string;
  publish_time: number;
  like_count: number;
};
// 获取新闻列表
export function getNews(): Promise<any> {
  return request('/ai/ai_intelligent/api/v1/ai_news', {
    method: 'GET',
  });
}

// 点赞
export function changeLike(params: any): Promise<any> {
  return request('/ai/ai_intelligent/api/v1/ai_news/like', {
    method: 'PUT',
    data: params,
  });
}
// 播放音频
export function playAudio(params: any): Promise<any> {
  return request('/ai/ai_intelligent/api/v1/ai_news/text_to_voice', {
    method: 'POST',
    data: params,
  });
}
// 文本优化
export function textOptimize(params: any): Promise<any> {
  return request('/ai/ai_intelligent/api/v1/ai_news/summary', {
    method: 'POST',
    data: params,
  });
}
// 获取用户Token
export function getUserToken(params: any): Promise<any> {
  return request('/apple/LoginService/LoginByVerifyCode', {
    method: 'POST',
    data: params,
  });
}
// 生成助写文案
export function createTextOrImg(params: any): Promise<any> {
  return request('/apple/AiService/AiCreateContent', {
    method: 'POST',
    data: params,
  });
}
// 发布
export function publishContent(params: any): Promise<any> {
  return request('/apple/SocialCircleService/PublishArticle', {
    method: 'POST',
    data: params,
  });
}
// 获取发布列表
export function getPublishList(params: any): Promise<any> {
  return request('/apple/SocialCircleService/RecommendArticles', {
    method: 'POST',
    data: params,
  });
}
// 点赞
export function changeLikeStatus(params: any): Promise<any> {
  return request('/apple/SocialCircleService/LikeArticle', {
    method: 'POST',
    data: params,
  });
}
// 发布评论
export function publishComment(params: any): Promise<any> {
  return request('/apple/SocialCircleService/PublishComment', {
    method: 'POST',
    data: params,
  });
}
// 查看评论列表
export function getCommentList(params: any): Promise<any> {
  return request('/apple/SocialCircleService/ListComment', {
    method: 'POST',
    data: params,
  });
}
